package com.kf;

import com.kf.gen.service.GenCodeService;
import com.kf.gen.utils.ApplicationContextUtils;
import com.kf.gen.utils.PropertyUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;
import javax.annotation.Resources;

/**
 * pro code application
 * use springBoot
 * <p>
 * Created by KINGFS on 2018/3/12.
 *
 * @author KINGFS
 */
@SpringBootApplication
@MapperScan(value = "com.kf.gen.dao")
public class GenCoreApplication {

    public static void main(String[] args) {
        // specify file path parameters in startup command
        String path = args[0];
//        String path = "D:\\SOFT\\Idea\\idea-workspace\\GEN-MASTER\\GEN-CORE-SERVICE\\src\\main\\resources\\application-conf.properties";
        // load conf-properties and set spring default properties
        SpringApplication springApplication = new SpringApplication(GenCoreApplication.class);
        springApplication.setDefaultProperties(PropertyUtils.load(path));
        springApplication.run(args);

        // start to pro code
        ApplicationContextUtils.getBean(GenCodeService.class).genCode();

        // finished pro code and exit
        System.exit(0);
    }

}
